//package org.destinyshine.cricket.connector;
//
//import org.destinyshine.cricket.context.WebApplicationContainer;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.nio.channels.Channels;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * Created by destinyliu on 2016/3/13.
// */
//public class MockConnector extends AbstractConnector implements Connector {
//    public MockConnector(WebApplicationContainer webApplicationContainer) {
//        super(webApplicationContainer);
//    }
//
//    public void sendMockRequest(String url) {
//        String[] reqInfos = new String[]{"GET", url, "HTTP 1.1"};
//        Map<String, List<String>> headers = new HashMap<>();
//        byte[] content = "hello".getBytes();
//
//        HttpServletRequestImpl request = new HttpServletRequestImpl(reqInfos, headers);
//        request.setContentBytes(content);
//        HttpServletResponseImpl response = new HttpServletResponseImpl(Channels.newChannel(System.out));
//        class MockConnection extends Connection {
//            MockConnection(HttpServletRequest request, HttpServletResponse response) {
//                this.setRequest(request);
//                this.setResponse(response);
//            }
//        }
//        MockConnection connection = new MockConnection(request, response);
//        getWebApplicationContainer().recevieConnection(connection);
//    }
//
//    @Override
//    public void connect() throws IOException {
//
//    }
//
//    @Override
//    public void disconnect() {
//
//    }
//}
